﻿#region
/* ===============================================
 * 作者：guopeng           时间：2012/3/26 19:13:49
 * 
 * 
 * 类描述：
 * 
 * 
 * =============================================== */
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ueEngine.Biz.Inf.Entities;
using ueEngine.Biz.Inf.LogicEntity.SupportData;
using ueEngine.Biz.Inf.Entities.DBSupport;


namespace ueEngine.Biz.Inf.LogicEntity
{
    /// <summary>
    /// 简历实体对象模型
    /// </summary>
    public class ResumeSheetModel : IAccessible<ResumeSheet, ResumeSheetModel>
    {
        #region self
        public int Id { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        public string Title { get; set; }
        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 联系姓名
        /// </summary>
        public string RealName { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        public Gender Gender { get; set; }

        /// <summary>
        /// 年龄
        /// </summary>
        public int Age { get; set; }

        /// <summary>
        /// 目前身份
        /// 如：在校大学生 自由职业者 公司职员 
        /// </summary>
        public SocialRole Status { get; set; }
        /// <summary>
        /// 最高学历
        /// </summary>
        public Degree Degree { get; set; }
        /// <summary>
        /// 毕业于
        /// </summary>
        public string College { get; set; }
        /// <summary>
        /// 兼职经历
        /// </summary>
        public string Experience { get; set; }
        /// <summary>
        /// 自我简介
        /// </summary>
        public string AboutMe { get; set; }

        /// <summary>
        /// 联系方式
        /// </summary>
        public string ContactPhone { get; set; }

        public string Email { get; set; }
        /// <summary>
        /// 详细地址
        /// </summary>
        public string Address { get; set; }
        /// <summary>
        /// 现居位置
        /// </summary>
        public AreaCode Area { get; set; }
        #endregion

        #region user
        public MemberModel Seeker { get; set; }
        #endregion

        protected override void Covariant(ResumeSheet dbModel)
        {
            this.AboutMe = dbModel.AboutMe;
            this.Age = dbModel.Age;
            this.ContactPhone = dbModel.ContactPhone;
            this.Experience = dbModel.Experience;
            this.Gender = dbModel.Gender ? Gender.Male : Gender.Female;
            this.Id = dbModel.Id;
            this.RealName = dbModel.RealName;
            this.Status = (SocialRole)dbModel.Status;
            this.Title = dbModel.Title;
            this.UserName = dbModel.UserName;
            this.Email = dbModel.EMail;
            this.Address = dbModel.Address;
            this.Area = (AreaCode)dbModel.Area;
            this.Degree = (Degree)dbModel.Degree;
            this.College = dbModel.College;
        }
        protected override ResumeSheet Inverter(ResumeSheetModel model)
        {
            return new ResumeSheet()
            {
                AboutMe = model.AboutMe,
                Age = model.Age,
                ContactPhone = model.ContactPhone,
                Experience = model.Experience,
                Gender = model.Gender == Gender.Male,
                Id = model.Id,
                RealName = model.RealName,
                Status = (int)model.Status,
                Title = model.Title,
                UserName = model.UserName,
                Address = model.Address,
                EMail = model.Email,
                Area = (int)model.Area,
                College = model.College,
                Degree = (int)model.Degree
            };
        }
        //public override ResumeSheetModel Element(System.Linq.Expressions.Expression<Func<ResumeSheet, bool>> where)
        //{
        //    Covariant(new ResumeSheet().Get(where));
        //    return this;
        //}
        //public override List<TResult> Elements<TResult>(System.Linq.Expressions.Expression<Func<ResumeSheet, bool>> where, System.Linq.Expressions.Expression<Func<ResumeSheet, TResult>> select)
        //{
        //    using (Context ctx = new Context())
        //    {
        //        return ctx.ResumeSheet.Where(where).Select(select).ToList();
        //    }
        //}
    }
}
